let emps = [{id:1,name:"admin",salary:400,is_admin:true},
            {id:2,name:"laozhang",salary:31,is_admin:true},
            {id:3,name:"wangwu",salary:3600,is_admin:false},
            {id:4,name:"zhaoliu",salary:4800,is_admin:true}
];
//find操作，可以查询满足条件的第一个元素
let e1 = emps.find(function(e){
  return e.salary>=500
})
console.log(e1);
//以上代码可以进行简写
e1 = emps.find(e=>e.salary>=500)
console.log(e1);

//filter是获取满足条件的一组元素
let e2 = emps.filter(e=>e.salary>500)
console.log(e2);

//findIndex:获取满足条件的索引,找不到会返回-1
let d1 = emps.findIndex(e=>e.name=='laozhang')
console.log(d1);
emps.splice(d1,1);//就可以把找到的对象删除
//以上操作根据用户名来删除对象
console.log(emps);

//reduce:累加
let sum = 0;
sum = emps.reduce((sum,e)=>sum+=e.salary,0)
console.log(sum);

//every:数组中所有的值都满足条件的要求就返回true
let rel = emps.every(e=>e.salary>500)
rel = emps.every(e=>e.salary>100)
console.log(rel);

//some:只要有一个条件满足就满足
let res = emps.some(e=>e.is_admin==false)
console.log(res);